home *** CD-ROM | disk | FTP | other *** search
- Path: maverick.tad.eds.com!stank01
- From: stank01@ny.rsc.gmeds.com (Shantanu G. Tank)
- Newsgroups: comp.lang.c
- Subject: Re: Returning a variable from system() function
- Date: 19 Jan 1996 16:55:12 GMT
- Organization: Eastern Resource Center
- Message-ID: <4doidg$nrj@maverick.tad.eds.com>
- References: <295336694wnr@iiga.demon.co.uk>
- NNTP-Posting-Host: gatekeeper.ny.rsc.gmeds.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- use popen instead...
-
- Pete Ryan (pete@iiga.demon.co.uk) wrote:
- : Hiya,
- : I`ve just been experimenting with C on UNIX and have come across a
- : problem!. There is a UNIX command called `find / -name gwire -print`
- : which scans the UNIX drive for files/directories containing `gwire`.
- : Anyway what I want to do is the following...
-
- : #include <stdio.h>
- : #include <stdlib.h>
- : etc
-
- : void main()
- : {
- : char tmp[];
- :
- : chdir("/usr2/willesden");
- :
- : */ offending code below ;( */
- : tmp = system("find . -name gwire");
-
- : printf("%s",tmp");
-
- : }
-
- : Therefore if I run `find . -name gwire -print` it returns all the
- : directories containing `gwire`. However the code above does not
- : work!!. Is it because `= system` returns an integer and not strings???
-
- : Any help would be very much appreciated as I have only just started
- : learning c in the last 2 months.
-
- :
- : -------------------------------|
- : | EMail pete@ |
- : | Mail sent via Demon Internet |
- : --------------------------------
-
- --
- Shantanu G. Tank
- EDS ERC Phone:716-439-3858 (8-449)
- Internet: stank01@ny.rsc.gmeds.com
- Lotus Notes: Shantanu G. Tank@UG_GM_LOC_HDL01 DIAMONDNET: LNUSHDLK(RZJNJJ)
-